﻿<Page
    x:Class="ParallaxBackgroundDemoApp.MainPage"
    IsTabStop="false"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:ParallaxBackgroundDemoApp"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:pbl="using:ParallaxBackgroundLibrary"
    mc:Ignorable="d">
    <Page.Resources>
        <pbl:ParallaxConverter
            x:Key="ParallaxConverter" />
    </Page.Resources>
    <Grid>
        <Rectangle>
            <Rectangle.Fill>
                <LinearGradientBrush
                    EndPoint="0.5,1"
                    StartPoint="0.5,0">
                    <GradientStop
                        Color="#FF5A8302"
                        Offset="0" />
                    <GradientStop
                        Color="#FFEEEE00"
                        Offset="1" />
                </LinearGradientBrush>
            </Rectangle.Fill>
        </Rectangle>
        <Canvas>
            <local:Trees>
                <local:Trees.RenderTransform>
                    <CompositeTransform
                        TranslateX="{Binding ElementName=MyScrollViewer, Path=HorizontalOffset, Converter={StaticResource ParallaxConverter}}"
                        ScaleX="0.25"
                        ScaleY="0.25" />
                </local:Trees.RenderTransform>
            </local:Trees>
        </Canvas>
        <Rectangle
            Fill="Black"
            Opacity="0.2" />
        <Canvas>
            <local:Trees>
                <local:Trees.RenderTransform>
                    <CompositeTransform
                        TranslateX="{Binding ElementName=MyScrollViewer, Path=HorizontalOffset, Converter={StaticResource ParallaxConverter}, ConverterParameter=-0.2}"
                        ScaleX="0.5"
                        ScaleY="0.5" />
                </local:Trees.RenderTransform>
            </local:Trees>
        </Canvas>
        <Rectangle
            Fill="Black"
            Opacity="0.2" />
        <ScrollViewer
            x:Name="MyScrollViewer"
            HorizontalScrollMode="Enabled"
            HorizontalScrollBarVisibility="Auto">
            <local:Trees />
        </ScrollViewer>
    </Grid>
</Page>
